<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: edit_value.php 11 2013-09-21 11:43:11Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 11 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-21 11:43:11 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

echo draw_form('values', FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_value&'.getMenuID('products_attributes').$val_add, 'post', 'id="dialog_form" enctype="multipart/form-data"'); 
echo draw_hidden_field('value_id', (int)$_GET['value_id']);
?>

<table width="100%" cellpadding="6">
	<?php for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
			$tr = (floor($rows+$i/2) == ($rows+$i/2) ? 'attributes-even' : 'attributes-odd'); 
			$lang_img = image('../lang/'.$languages[$i]['directory'].'/'.$languages[$i]['image'], $languages[$i]['name']);
			?>
		<tr>
			<td width="15%">
				<strong><?php echo TABLE_HEADING_OPT_NAME; ?></strong>
			</td>
			<td width="40%">
				<?php
					echo $lang_img;
				?>
				<select name="option_id">
					<?php
					$options_names = $db->db_query("SELECT
														products_options_id,
														products_options_name
													FROM
														".TABLE_PRODUCTS_OPTIONS."
													WHERE
														language_id = '".$languages[$i]['id']."'
													ORDER BY
														products_options_id ASC");
					while(!$options_names->EOF) {
						echo '<option name="'.$options_names->fields['products_options_name'].'" value="'.$options_names->fields['products_options_id'].'"';
						if($_GET['value_id'] == $options_names->fields['products_options_id'])
							echo ' selected="selected"';
						echo '>'.$options_names->fields['products_options_name'].'</option>';
						$options_names->MoveNext();
					}
					?>
				</select>
			</td>
		</tr>
			<?php
				$value_name = $db->db_query("SELECT
												products_options_values_name,
												products_options_values_desc,
												products_options_values_image,
												products_options_hex_image
											FROM
												".TABLE_PRODUCTS_OPTIONS_VALUES."
											WHERE
												products_options_values_id = '".(int)$_GET['value_id']."'
											AND
												language_id = '".$languages[$i]['id']."'");


				$inputs_image = $lang_img.' '. draw_file_field('value_image_'. $languages[$i]['id']). '<br />';
				if(!empty($value_name->fields['products_options_values_image'])) {
					$inputs_image = '<img class="opt_val_img" src="../images/product_options/'.$value_name->fields['products_options_values_image'].'" alt="" />';
					$input_del = $value_name->fields['products_options_values_image'].'<br /><input type="checkbox" name="del_value_image_'.$languages[$i]['id'].'" value="yes" /> L&ouml;schen?';
				}
				echo draw_hidden_field('previous_val_image', $value_name->fields['products_options_image'])."\n";
				$inputs_desc = $lang_img.' <textarea name="value_desc['.$languages[$i]['id'].']" cols="50" rows="4" style="width:95%">'.$value_name->fields['products_options_values_desc'].'</textarea><br />';
			?>
		<tr>
			<td>
				<strong><?php echo TABLE_HEADING_OPT_VALUE; ?>:</strong>
			</td>
			<td>
				<?php echo $lang_img.' <input value="'.$value_name->fields['products_options_values_name'].'" type="text" name="value_name['.$languages[$i]['id'].']" size="15" /><br />'; ?>
			</td>
		</tr>
		<tr>
			<td>
				<strong>Farbfeld:</strong>
			</td>
			<td>
				<?php
					echo draw_input_field('hex_image['.$languages[$i]['id'].']', $value_name->fields['products_options_hex_image'], 'class="multiple" style="margin-left:22px;width:60px"');
				?>
			</td>
		</tr>
		<tr>
			<td valign="top">
				<strong><?php echo TABLE_HEADING_OPT_IMAGE; ?>:</strong>
			</td>
			<td>
				<?php echo $inputs_image.' '.$input_img.' '.$input_del; ?>
			</td>
		</tr>
		<tr>
			<td class="attributs_name" valign="top">
				<strong><?php echo TABLE_HEADING_OPT_DESC; ?>:</strong>
			</td>
			<td class="attributs_name">
				<?php echo $inputs_desc; ?>
			</td>
		</tr>
	<?php } ?>
	</table>
</form>